{include app:admin.inc.header}
<!--tmpl-resource-->
{include app:admin.inc.top}


<div class="container-fluid content-body">
	<div class="main">
		<!-- left side start-->
		{include admin.inc.menu}
		<!-- left side end-->


		<!-- main content start-->
		<section class="right-section" id="right-section">
			<!-- start of inner-frame -->
			<div class="inner-iframe">

				<!-- page breadcrumb start-->
				{include admin.inc.bread}
				<!-- page "breadcrumb end-->
				<!-- Nav tabs -->
				<ul class="nav nav-tabs">

					<li {if $id==''}class="active"{/if}><a {if $id==''}href="javascript:void(0);"{else}href="{$add_url}"{/if}><i class="glyphicon glyphicon-plus"></i> 添加角色</a></li>
					<li><a href="{$index_url}" ><i class="glyphicon glyphicon-th-list"></i> 角色列表</a></li>
					{if $id != ''}<li class="active"><a href="javascript:void(0);"><i class="glyphicon glyphicon-edit"></i> 编辑角色</a></li>{/if}

				</ul>
				<div class="inner-container">
					<form role="form" class="content-add-form" id="content-add-form" autocomplete="off">

						<!--tmpl-fields-->

						<!-- input -->
						<div class="form-group">
							<label >
								<span class="asterisk">*</span>
								角色名称
							</label>
							<input  dtype="" class="form-control" maxlength="20" name="data[name]" placeholder="" required cname="" value="{$item[name]}" />
						</div>
						<p class="help-block"></p>
						
						<!-- textarea -->
						<div class="form-group">
							<label >
								角色描述
							</label>
							<textarea class="form-control" maxlength="100" name="data[remark]" placeholder="" cname="">{$item[remark]}</textarea>
						</div>
						<p class="help-block"></p>
						
						<section class="panel">
							<header class="panel-heading custom-tab ">
								<ul class="nav nav-tabs" id="tab-priv">
									{loop $module_config $k $v}
									<li class="{if $k=='common'}active{/if}">
									<a href="#tab_{$k}" aria-controls="tab_{$k}" role="tab" data-toggle="tab">{$k}</a>
									</li>
									{/loop}
								</ul>
							</header>
							<div class="panel-body">
								<div class="tab-content">
									{loop $module_config $k $v}
									<div  class="tab-pane icheck minimal {if $k=='common'}active{/if}" id="tab_{$k}">
										{loop $v $kk $vv}
										<?php 
											$hasChild = false;
											foreach($nodes as $s => $t){
												if(strpos($t[node_key],'admin/'.$kk .'/') !== false){
													$hasChild = true;
												}
											} 
											if(!$hasChild){
												continue;
											}
										?>
										<dl>
											<dt class="row">
												<label class="checkbox"><input type="checkbox" >
												&nbsp;{$vv}</label>
											</dt>
											<dd class="row" style="margin-left:40px;">
											{loop $nodes $s $t}
											{if strpos($t[node_key],'admin/'.$kk.'/') !== false}
											<div class="col-xs-3">
												<label class="checkbox"><input {if in_array($t[id],$role_node_ids)}checked='checked'{/if} type="checkbox" name="node[{$t[id]}]" />
												{$t[name]}</label>
											</div>
											{/if}
											{/loop}
											</dd>
										</dl>
										{/loop}
									</div>
									{/loop}
								</div>
							</div>
						</section>

						<div class="btn-group btn-group-or">
							<a href="{if $id==''}{$do_add_url}{else}{$do_edit_url}?id={$id}{/if}" class="btn btn-primary ajaxproxy"
								proxy='{"method":"post", "location":"{$index_url}"}'>提交保存</a>

						</div>
					</form><!-- content add form -->
				</div>
			</div><!-- end of inner -->
		</section>
	</div>
</div>
{include admin.inc.footer}

<!--tmpl-script-->

<!-- assocalert -->
<script id="admin_manager-assoc-box" type="text/html">
<div class="assoc-alertbox">
	<div class="searchbar">
		<form class="assoc-foreign-form form-inline">
			<!--tmpl-search-->

			<!-- searchinput -->
			<div class="form-group">
				<div class="input-group">
					<div class="input-group-addon">
						用户名
					</div>
					<input type="text" class="form-control input-sm" maxlength="20" placeholder="用户名" name="s_username" value="{$s_username}">
				</div>
			</div>
			
			
			
			<!-- searchinput -->
			<div class="form-group">
				<div class="input-group">
					<div class="input-group-addon">
						工号
					</div>
					<input type="text" class="form-control input-sm" maxlength="{maxlength}" placeholder="工号" name="s_jobno" value="{$s_jobno}">
				</div>
			</div>
			
			
			<!-- searchinput -->
			<div class="form-group">
				<div class="input-group">
					<div class="input-group-addon">
						姓名
					</div>
					<input type="text" class="form-control input-sm" maxlength="16" placeholder="姓名" name="s_name" value="{$s_name}">
				</div>
			</div>
			
			<!-- searchselect -->
			<div class="form-group">
				<div class="input-group">
					<div class="input-group-addon">
						角色ID
					</div>
					<select id="s_role_id" class="form-control select2" name="s_role_id">
						<option value="">-- 请选择 --</option>
						<!--tmpl-options-->
			
						<!-- selectoptions -->
						{loop $role_idoptions $v}
						<option {if $item[role_id] == $v[id]}selected{/if} value="{$v[id]}">{$v[id]}</option>
						{/loop}
						
			
					</select>
				</div>
			</div>
			
			<!-- searchdatetime -->
			<div class="form-group">
				<div class="input-group">
					<div class="input-group-addon">
						最后登陆时间
					</div>
					<input style="width:100px;" class="form-control form-control-inline input-sm mdate"  size="16" type="text"
					name="s_s_last_login_time" value="{$s_s_last_login_time}"
					placeholder="开始最后登陆时间" />
			
					<div class="input-group-addon">
						-
					</div>
					<input style="width:100px;" class="form-control form-control-inline input-sm mdate"  size="16" type="text"
					name="s_e_last_login_time" value="{$s_e_last_login_time}"
					placeholder="结束最后登陆时间" />
				</div>
			</div>
			
			
			<!-- searchselect -->
			<div class="form-group">
				<div class="input-group">
					<div class="input-group-addon">
						账户状态
					</div>
					<select id="s_status" class="form-control select2" name="s_status">
						<option value="">-- 请选择 --</option>
						<!--tmpl-options-->
			
						<!-- option -->
						<option value="1">正常</option>
						
						<!-- option -->
						<option value="0">禁用</option>
						
			
					</select>
				</div>
			</div>
			
			<!-- searchdatetime -->
			<div class="form-group">
				<div class="input-group">
					<div class="input-group-addon">
						添加时间
					</div>
					<input style="width:100px;" class="form-control form-control-inline input-sm mdate"  size="16" type="text"
					name="s_s_addtime" value="{$s_s_addtime}"
					placeholder="开始添加时间" />
			
					<div class="input-group-addon">
						-
					</div>
					<input style="width:100px;" class="form-control form-control-inline input-sm mdate"  size="16" type="text"
					name="s_e_addtime" value="{$s_e_addtime}"
					placeholder="结束添加时间" />
				</div>
			</div>
			
			<!-- searchdatetime -->
			<div class="form-group">
				<div class="input-group">
					<div class="input-group-addon">
						更新时间
					</div>
					<input style="width:100px;" class="form-control form-control-inline input-sm mdate"  size="16" type="text"
					name="s_s_updatetime" value="{$s_s_updatetime}"
					placeholder="开始更新时间" />
			
					<div class="input-group-addon">
						-
					</div>
					<input style="width:100px;" class="form-control form-control-inline input-sm mdate"  size="16" type="text"
					name="s_e_updatetime" value="{$s_e_updatetime}"
					placeholder="结束更新时间" />
				</div>
			</div>
			
			

			<input type="hidden" name="order" value="{$order}">
			<input type="btn" class="btn btn-sm btn-success assoc-search-btn" value="搜索"/>
		</form>
	</div>
	<div class="content">
	
	</div>
	<div class="paginate">

	</div>
</div>
</script>

<!-- assoclist -->
<script id="admin_manager-assoc-tablelist" type="text/html">
<table class="table  table-condense">
	<tr>
		<th><input type="checkbox" id="assoc-selectall" ></th>
		<!--tmpl-th-->

		<th>用户名</th>
		<th>密码</th>
		<th>手机号码</th>
		<th>工号</th>
		<th>电子邮箱</th>
		<th>姓名</th>
		<th>角色ID</th>
		<th>最后登陆时间</th>
		<th>最后登陆ip</th>
		<th>账户状态</th>
		<th>添加时间</th>
		<th>更新时间</th>
		<th>AppId</th>

	</tr>
	{[each item]}
	<tr>
		<td><input type="checkbox" name="assoc[]" value="{[$value.id]}"></td>
		<!--tmpl-td-->
		<td>{[$value.username]}</td>
		<td>{[$value.password]}</td>
		<td>{[$value.mobile]}</td>
		<td>{[$value.jobno]}</td>
		<td>{[$value.email]}</td>
		<td>{[$value.name]}</td>
		<td>{[$value.admin_manager_role_id]}</td>
		<td>{[$value.last_login_time]}</td>
		<td>{[$value.last_login_ip]}</td>
		<td>{[$value.status]}</td>
		<td>{[$value.addtime]}</td>
		<td>{[$value.updatetime]}</td>
		<td>{[$value.app_id]}</td>
	</tr>
	{[/each]}
</table>
</script>

<!-- assocalert -->
<script id="admin_node-assoc-box" type="text/html">
<div class="assoc-alertbox">
	<div class="searchbar">
		<form class="assoc-foreign-form form-inline">
			<!--tmpl-search-->

			<!-- searchinput -->
			<div class="form-group">
				<div class="input-group">
					<div class="input-group-addon">
						
					</div>
					<input type="text" class="form-control input-sm" maxlength="50" placeholder="" name="s_name" value="{$s_name}">
				</div>
			</div>
			
			<!-- searchinput -->
			<div class="form-group">
				<div class="input-group">
					<div class="input-group-addon">
						
					</div>
					<input type="text" class="form-control input-sm" maxlength="50" placeholder="" name="s_node_key" value="{$s_node_key}">
				</div>
			</div>
			
			<input type="hidden" name="order" value="{$order}">
			<input type="btn" class="btn btn-sm btn-success assoc-search-btn" value="搜索"/>
		</form>
	</div>
	<div class="content">
	
	</div>
	<div class="paginate">

	</div>
</div>
</script>

<!-- assoclist -->
<script id="admin_node-assoc-tablelist" type="text/html">
<table class="table  table-condense">
	<tr>
		<th><input type="checkbox" id="assoc-selectall" ></th>
		<!--tmpl-th-->

		<th></th>
		<th></th>
		<th></th>
		<th></th>
		<th></th>
		<th></th>
		<th></th>
		<th>AppId</th>

	</tr>
	{[each items]}
	<tr>
		<td><input type="checkbox" name="assoc[]" value="{[$value.id]}"></td>
		<!--tmpl-td-->
		<td>{[$value.name]}</td>
		<td>{[$value.node_key]}</td>
		<td>{[$value.remark]}</td>
		<td>{[$value.addtime]}</td>
		<td>{[$value.edittime]}</td>
		<td>{[$value.admin_manager_id]}</td>
		<td>{[$value.del_status]}</td>
		<td>{[$value.app_id]}</td>

	</tr>
	{[/each]}
</table>
</script>



<!-- pagescript -->
<script type="text/javascript">
	seajs.use("admin/admin_roleadd",function (parameter){
		
		/**--tmpl-templatejavascript--**/
		
		<!--tmpl-templatejavascript-->

		parameter.admin_manager_assoc_url="{$admin_manager_assoc_url}";
		parameter.admin_node_assoc_url="{$admin_node_assoc_url}";

		parameter.upload_url="{$upload_url}";
		parameter.image_search_url="{$image_search_url}";
		parameter.image_list_url="{$image_list_url}";
		
		parameter.init();		
		$('#tab-priv li:first-child a').trigger('click');
	});
</script>


<script id="assocpage" type="text/html">
<div class="text-right">
	<ul class="pagination blog-pagination">
		<li><a class="assoc-page" data-page="{[prev]}" href="javascript:void(0);">上一页</a></li> 
		{[each pages]}

		<li ><a class="assoc-page" data-page="{[$value]}" {[if curr == $value]}class="active"{[/if]} href="javascript:void(0)">{[$value]}</a></li> 

		{[/each]}
		<li><a class="assoc-page" href="javascript:void(0);" data-page="{[nexts]}">下一页</a></li> 
	</ul>	
</div>
</script>

</body>
</html>
